// const sum = (...args) => {
//   return args.reduce((a, b) => a + b, 0);
// };

// console.log(sum(1, 4)); // 15;

// const cheng = (...args) => {
//   return args.filter(item => {
//     return item % 2 !== 0;
//   });
// };

// console.log(cheng(1,2,3,4,5,6,7,8,9));
// console.log(cheng(...[1,2,3,4]));

const debounce = (fn, timer) => {
  let timerId = null;
  return (...args) => {
    clearTimeout(timerId);
    timerId = setTimeout(() => {
      fn(...args);
    }, timer);
  };
};

const newHandler=debounce();
